feat(monorepo): apps/* aware worktrees, preflight, and gx watch#606
Merged
Conversation
Four wins for repos with apps/<pkg> (storefront + backend monorepos like the Medusa shops) where the root worktree stays on the protected base so dev servers visualize merged state: 1. Env symlink + auto port on worktree creation prepareAgentWorktree() symlinks root apps/<pkg>/.env into every spawned agent worktree and writes a .env.local with a free PORT=N (storefront pool 5174+, backend pool 9101+). 2. AGENTS.md monorepo block on gx setup templates/AGENTS.monorepo-apps.md with the per-task loop and cross-app guardrails. Auto-detected via apps/<pkg>/package.json. 3. Pre-ship typecheck + lint preflight runPreflight() walks the diff against the base, finds touched apps/<pkg> workspace packages, runs typecheck + lint scripts. Blocks the PR on any failure. Bypass with --skip-preflight. 4. gx watch — live TUI for agent worktrees Alternate-screen dashboard refreshing every 2s with last commit, dirty count, dev server port(s), and PR status (when gh present). Zero new test failures (38 pass / 6 fail baseline preserved). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four wins for repos with
apps/<pkg>monorepos (storefront + backend like the Medusa shops) where the root worktree stays on the protected base so dev servers visualize merged state:prepareAgentWorktree()symlinks rootapps/<pkg>/.envinto every spawned agent worktree and writes.env.localwith a freePORT=N(storefront pool 5174+, backend pool 9101+).gx setup—templates/AGENTS.monorepo-apps.mdauto-detected viaapps/<pkg>/package.json.typecheck+lintbefore opening the PR. Bypass with--skip-preflight.gx watchlive TUI — alternate-screen dashboard refreshing every 2s with last commit, dirty count, dev server port(s), PR status.Test plan
gx watch --onceagainst LIFTEDV2 renders correctly[agent-branch-start] worktree-prep ...lines🤖 Generated with Claude Code